package apis

import (
	"gitee.com/byx_darwin/ncloud-go/core"
	"gitee.com/byx_darwin/ncloud-go/core/net/consts"
)

type CreateLineConditions struct {
	CountryCode string `json:"country_code"`
	CityName    string `json:"city_name,omitempty"`
	Days        int64  `json:"days"`
	Count       int64  `json:"count"`
}

type LineCreateRequest struct {
	core.NCloudRequest
	CreateLineConditions
}

func NewLineCreateRequest(countryCode string, days, count int64) *LineCreateRequest {
	return &LineCreateRequest{
		NCloudRequest: core.NCloudRequest{
			Path:   "/static/line",
			Method: consts.MethodPost,
		},
		CreateLineConditions: CreateLineConditions{
			CountryCode: countryCode,
			Days:        days,
			Count:       count,
		},
	}
}

func NewLineCreateRequestWithParams(countryCode, cityName string, days, count int64) *LineCreateRequest {
	return &LineCreateRequest{
		NCloudRequest: core.NCloudRequest{
			Path:   "/static/line",
			Method: consts.MethodPost,
		},
		CreateLineConditions: CreateLineConditions{
			CountryCode: countryCode,
			CityName:    cityName,
			Days:        days,
			Count:       count,
		},
	}
}

func (r *LineCreateRequest) SetCityName(cityName string) {
	r.CityName = cityName
}

type LineInfo struct {
	CountryCode string `json:"country_code"`
	CityName    string `json:"city_name,omitempty"`
	IP          string `json:"ip"`
	Poxy        string `json:"poxy"`
	Account     string `json:"account"`
	Password    string `json:"password"`
	ExpireTime  string `json:"expire_time"`
}

type LineCreateResponse struct {
	Code    int        `json:"code"`
	Msg     string     `json:"msg"`
	Data    []LineInfo `json:"data"`
	TrackID string     `json:"track_id"`
}
